package com.zhenhunfan.io.model.bio.demo03;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * <p>Title: ServerHandlerExecutePool</p>
 * <p>Description: </p>
 *
 * @author zhenhunfan
 * @version 1.0.0
 * @date 2021/3/31
 */
public class ServerHandlerExecutePool {
    private ExecutorService executorService;

    public ServerHandlerExecutePool(int maxPoolSize,int quereSize){
        executorService = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(),
                maxPoolSize,10L,
                TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(quereSize));
    }

    public void execute(Runnable task){
        executorService.execute(task);
    }

}
